﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.IO;
using Com.CodePlex.SPPower.Data;
using Com.CodePlex.SPPower.Controller;
using Com.CodePlex.SPPower.Model;
using System.Windows.Input;
using System.Text;
using System.Text.RegularExpressions;
//using Com.CodePlex.SPPower.View; //should not reference this http://social.msdn.microsoft.com/Forums/is/wpf/thread/3bced3ea-4a97-4456-bfe5-828289bcf971

namespace Com.CodePlex.SPPower.ViewModel {

    public class CmdViewModel : ViewModel {

        public Cmd Item { get; private set; }
        public CmdCategoryViewModel Parent { get; private set; }

        public CmdViewModel(Cmd item, CmdCategoryViewModel parent) {
            if (item == null) {
                throw new ArgumentNullException("item");
            }
            this.Item = item;
            DisplayName = item.Name;
            Parent = parent;
            Mediator.Register(this);
            //note: lazy load: dont do more stuff here
        }

        #region Display Properties

        private bool isselected;
        public bool IsSelected {
            get { return isselected; }
            set {
                if (value != isselected) {
                    isselected = value;
                    OnPropertyChanged(() => IsSelected);
                }
            }
        }

        public bool IsExpanded {
            set {
                if (Parent != null) {
                    Parent.IsExpanded = value;
                }
            }
        }

        public string ImageSource {
            get { return "pack://application:,,,/Resources/Images/RedDot.jpg"; }
        }

        #endregion
    }
}